<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:office="http://openoffice.org/2000/office" xmlns:style="http://openoffice.org/2000/style" xmlns:text="http://openoffice.org/2000/text" xmlns:table="http://openoffice.org/2000/table" xmlns:draw="http://openoffice.org/2000/drawing" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="http://openoffice.org/2000/meta" xmlns:number="http://openoffice.org/2000/datastyle" xmlns:svg="http://www.w3.org/2000/svg" xmlns:chart="http://openoffice.org/2000/chart" xmlns:dr3d="http://openoffice.org/2000/dr3d" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="http://openoffice.org/2000/form" xmlns:script="http://openoffice.org/2000/script" xmlns:config="http://openoffice.org/2001/config" version="1.0" office:class="text" office:version="1.0">
<xsl:output method="xml" indent="yes" omit-xml-declaration="no"/>

<xsl:template match="book">
    <book>
        <xsl:for-each select="rule">
            <xsl:choose>
                <xsl:when test="@link='chapter'"></xsl:when>
                <xsl:when test="@link='paragraph'"></xsl:when>
                <xsl:when test="@link='rule'"></xsl:when>
                <xsl:when test="@link='background'"></xsl:when>
                <xsl:when test="@link='race'"></xsl:when>
                <xsl:when test="@link='jobs'"></xsl:when>
                <xsl:when test="@link='culture'"></xsl:when>
                <xsl:when test="@link='deity'"></xsl:when>
                <xsl:when test="@link='skill'"></xsl:when>
                <xsl:when test="@link='item'"></xsl:when>
                <xsl:when test="@link='action'"></xsl:when>
                <xsl:when test="@link='aging'"></xsl:when>
                <xsl:when test="@link='gender'"></xsl:when>

  <xsl:otherwise>
    ... some output ....
  </xsl:otherwise>
</xsl:choose>
            <text:h text:style-name="Heading_20_1" text:outline-level="1"><xsl:value-of select="@name"/></text:h>
            <text:p><xsl:value-of select="@description"/></text:p>
            <xsl:for-each select="rule">
                <text:h text:style-name="Heading_20_3" text:outline-level="3"><xsl:value-of select="@name"/></text:h>
                <text:p><xsl:value-of select="@description"/></text:p>
            </xsl:for-each>
        </xsl:for-each>
    </book>
</xsl:template>

</xsl:stylesheet>

